In mathematics, the horizontal line test is a test used to determine if a function is injective[1] and/or surjective. The lines used for the test are parallel to the x axis.
Consider a function f : X → Y with its corresponding graph as a subset of the Cartesian product X x Y. Consider the horizontal lines in X x Y : .
Passes the test (injective) |
Fail the test (not injective) |
This test is also used to determine whether or not the inverse relation of a function is itself a function.